<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var a = ['tom1','tom1','jack','tom1','tom','frank'];
    var r = a.indexOf('tom',0);//找不到为-1，找到为 1.
    //var r2 = a.lastIndexOf('tom')//从右向左找
    var r2 = a.lastIndexOf('tom',3)//从左向右找
    console.log(r2);
</script>
</body>
</html>